Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format help message without extra stuff #359

Closed
wants to merge 2 commits into from

Conversation

abitrolly
Copy link
Contributor

@abitrolly abitrolly commented Nov 18, 2021

Changes help output for the main command to this.

usage: podman_compose.py [options] [command]

commands:
  build    build stack images
  down     tear down entire stack
  exec     execute a command in a running container
  help     show help
  logs     show logs from services
  ps       show status of containers
  pull     pull stack images
  push     push stack images
  restart  restart specific services
  run      create a container similar to a service to run a one-off command
  start    start specific services
  stop     stop specific services
  up       Create and start the entire stack or some of its services
  version  show version

options:
  -h --help                      show this help message and exit
  -v --version                   show version
  -f --file FILE                 Specify an alternate compose file (default: docker-compose.yml)
  -p --project-name              Specify an alternate project name (default: directory name)
     --podman-path               Specify an alternate path to podman (default: use location in $PATH variable)
     --podman-args ARGS          custom global arguments to be passed to `podman`
     --podman-pull-args ARGS     custom arguments to be passed to `podman pull`
     --podman-push-args ARGS     custom arguments to be passed to `podman push`
     --podman-build-args ARGS    custom arguments to be passed to `podman build`
     --podman-inspect-args ARGS  custom arguments to be passed to `podman inspect`
     --podman-run-args ARGS      custom arguments to be passed to `podman run`
     --podman-start-args ARGS    custom arguments to be passed to `podman start`
     --podman-stop-args ARGS     custom arguments to be passed to `podman stop`
     --podman-rm-args ARGS       custom arguments to be passed to `podman rm`
     --podman-volume-args ARGS   custom arguments to be passed to `podman volume`
     --no-ansi                   Do not print ANSI control characters
     --no-cleanup                Do not stop and remove existing pod & containers
     --dry-run                   No action; perform a simulation of commands
  -t --transform_policy TRANSFORM_POLICY  how to translate docker compose to podman (default: 1podfw)
    1podfw - create all containers in one pod (inter-container communication is done via localhost), doing port mapping in that pod
    1pod - create all containers in one pod, doing port mapping in each container (does not work)
    identity - no mapping
    hostnet - use host network, and inter-container communication is done via host gateway and published ports
    cntnet - create a container and use it via --network container:name (inter-container communication via localhost)
    publishall - publish all ports to host (using -P) and communicate via gateway

@abitrolly abitrolly changed the title WIP: Format help message without extra stuff Format help message without extra stuff Nov 26, 2021
@muayyad-alsadi
Copy link
Collaborator

the current podman-compose --help gives the following output

usage: podman_compose.py [-h] [-v] [-f file] [-p PROJECT_NAME] [--podman-path PODMAN_PATH] [--podman-args args] [--podman-pull-args args] [--podman-push-args args] [--podman-build-args args] [--podman-inspect-args args]
                         [--podman-run-args args] [--podman-start-args args] [--podman-stop-args args] [--podman-rm-args args] [--podman-volume-args args] [--no-ansi] [--no-cleanup] [--dry-run]
                         [-t {1pod,1podfw,hostnet,cntnet,publishall,identity}]
                         {help,version,pull,push,build,up,down,ps,run,exec,start,stop,restart,logs} ...

optional arguments:
  -h, --help            show this help message and exit
  -v, --version         show version
  -f file, --file file  Specify an alternate compose file (default: docker-compose.yml)
  -p PROJECT_NAME, --project-name PROJECT_NAME
                        Specify an alternate project name (default: directory name)
  --podman-path PODMAN_PATH
                        Specify an alternate path to podman (default: use location in $PATH variable)
  --podman-args args    custom global arguments to be passed to `podman`
  --podman-pull-args args
                        custom arguments to be passed to `podman pull`
  --podman-push-args args
                        custom arguments to be passed to `podman push`
  --podman-build-args args
                        custom arguments to be passed to `podman build`
  --podman-inspect-args args
                        custom arguments to be passed to `podman inspect`
  --podman-run-args args
                        custom arguments to be passed to `podman run`
  --podman-start-args args
                        custom arguments to be passed to `podman start`
  --podman-stop-args args
                        custom arguments to be passed to `podman stop`
  --podman-rm-args args
                        custom arguments to be passed to `podman rm`
  --podman-volume-args args
                        custom arguments to be passed to `podman volume`
  --no-ansi             Do not print ANSI control characters
  --no-cleanup          Do not stop and remove existing pod & containers
  --dry-run             No action; perform a simulation of commands
  -t {1pod,1podfw,hostnet,cntnet,publishall,identity}, --transform_policy {1pod,1podfw,hostnet,cntnet,publishall,identity}
                        how to translate docker compose to podman (default: 1podfw)
                            1podfw - create all containers in one pod (inter-container communication is done via localhost), doing port mapping in that pod
                            1pod - create all containers in one pod, doing port mapping in each container (does not work)
                            identity - no mapping
                            hostnet - use host network, and inter-container communication is done via host gateway and published ports
                            cntnet - create a container and use it via --network container:name (inter-container communication via localhost)
                            publishall - publish all ports to host (using -P) and communicate via gateway

command:
  {help,version,pull,push,build,up,down,ps,run,exec,start,stop,restart,logs}
    help                show help
    version             show version
    pull                pull stack images
    push                push stack images
    build               build stack images
    up                  Create and start the entire stack or some of its services
    down                tear down entire stack
    ps                  show status of containers
    run                 create a container similar to a service to run a one-off command
    exec                execute a command in a running container
    start               start specific services
    stop                stop specific services
    restart             restart specific services
    logs                show logs from services

the current docker-compose --help gives the following output

$ docker-compose --help
Define and run multi-container applications with Docker.

Usage:
  docker-compose [-f <arg>...] [--profile <name>...] [options] [--] [COMMAND] [ARGS...]
  docker-compose -h|--help

Options:
  -f, --file FILE             Specify an alternate compose file
                              (default: docker-compose.yml)
  -p, --project-name NAME     Specify an alternate project name
                              (default: directory name)
  --profile NAME              Specify a profile to enable
  -c, --context NAME          Specify a context name
  --verbose                   Show more output
  --log-level LEVEL           Set log level (DEBUG, INFO, WARNING, ERROR, CRITICAL)
  --ansi (never|always|auto)  Control when to print ANSI control characters
  --no-ansi                   Do not print ANSI control characters (DEPRECATED)
  -v, --version               Print version and exit
  -H, --host HOST             Daemon socket to connect to

  --tls                       Use TLS; implied by --tlsverify
  --tlscacert CA_PATH         Trust certs signed only by this CA
  --tlscert CLIENT_CERT_PATH  Path to TLS certificate file
  --tlskey TLS_KEY_PATH       Path to TLS key file
  --tlsverify                 Use TLS and verify the remote
  --skip-hostname-check       Don't check the daemon's hostname against the
                              name specified in the client certificate
  --project-directory PATH    Specify an alternate working directory
                              (default: the path of the Compose file)
  --compatibility             If set, Compose will attempt to convert keys
                              in v3 files to their non-Swarm equivalent (DEPRECATED)
  --env-file PATH             Specify an alternate environment file

Commands:
  build              Build or rebuild services
  config             Validate and view the Compose file
  create             Create services
  down               Stop and remove resources
  events             Receive real time events from containers
  exec               Execute a command in a running container
  help               Get help on a command
  images             List images
  kill               Kill containers
  logs               View output from containers
  pause              Pause services
  port               Print the public port for a port binding
  ps                 List containers
  pull               Pull service images
  push               Push service images
  restart            Restart services
  rm                 Remove stopped containers
  run                Run a one-off command
  scale              Set number of containers for a service
  start              Start services
  stop               Stop services
  top                Display the running processes
  unpause            Unpause services
  up                 Create and start containers
  version            Show version information and quit

what is the objective of this PR? and why it's better?

@abitrolly
Copy link
Contributor Author

The goal was to remove the unnecessary "extra stuff" produced by argparse.

  {help,version,pull,push,build,up,down,ps,run,exec,start,stop,restart,logs}

Both in command and in usage description.

@muayyad-alsadi muayyad-alsadi deleted the branch containers:devel December 9, 2021 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants